package com.example.www.jiguvideo.module.mapper;


import com.example.www.jiguvideo.module.entity.Video;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.math.BigInteger;
import java.util.List;

@Mapper
public interface VideoMapper {


    @Select("select * from video WHERE id=#{id} and is_deleted = 0")
    Video getById(@Param("id") BigInteger id);

    @Select("select * from video where is_deleted = 0")
    List<Video> getAll();

    int insert(@Param("video")  Video video);


    int update(@Param("video")  Video video);

    @Update("update video set is_deleted=1, update_time=#{time} where id=#{id} limit 1")
    int delete(@Param("id") BigInteger id, @Param("time") Integer time);
}
